package rongyun

import (
	"context"
	"selfService/tool"
)

type RongyunServiceImpl struct {
}



func (this RongyunServiceImpl)RegisterUser(c context.Context, req *RongyunRegisterUserRequest) (*RongyunRegisterUserResponse, error) {
	rc := tool.RongYunUtil()
	user, err := rc.UserRegister(req.UserId, req.Name, req.Portrait);
	if err!=nil{
		return nil, err
	}
	return &RongyunRegisterUserResponse{
		UserId : user.UserID,
		Token :user.Token,
	}, nil
}
func (this RongyunServiceImpl)BanUser(c context.Context, req *RongyunBanUserRequest) (*RongyunBanUserResponse, error) {
	rc := tool.RongYunUtil()
	err := rc.BlockAdd(req.UserId, req.Minute)
	if err != nil {
		return nil, err
	}
	return &RongyunBanUserResponse{
		Code: 200,
	},nil
}
